//
//  ViewControllerForClickLunBo.m
//  
//
//  Created by dllo on 16/1/22.
//
//

#import "ViewControllerForClickLunBo.h"
#import <MBProgressHUD.h>

@interface ViewControllerForClickLunBo ()

@property (nonatomic, retain)UIWebView *webView;
@property (nonatomic, retain)MBProgressHUD *HUD;

@end

@implementation ViewControllerForClickLunBo

- (void)dealloc {
    [_url release];
    [_HUD release];
    [_webView release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
   
    self.webView = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    NSURL *url = [NSURL URLWithString:self.url];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.view addSubview:self.webView];
    [self.webView loadRequest:request];
    [_webView release];
    
}

- (void)viewWillAppear:(BOOL)animated {
    /** 初始化进度框, 置于当前的View中 */
    self.HUD = [[MBProgressHUD alloc] initWithView:self.view];
    
    [self.view addSubview:self.HUD];
    
    /** 如果设置此属性则当前的view置于后台 */
    self.HUD.dimBackground = YES;
    
    self.HUD.labelText = @"请稍等";
    
    /** 显示对话框 */
    [self.HUD showAnimated:YES whileExecutingBlock:^{
        
        /** 对话框显示时需要执行的操作 */
        sleep(1);
        
    } completionBlock:^{
        
        /** 操作执行完后取消对话框 */
        [self.HUD removeFromSuperview];
        
        self.HUD = nil;
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
